1. Field
The following relates generally to ray tracing systems that can be used, for example, in rendering 2-D representations of 3-D scenes, and more specifically to aspects of how rays to be traced in such systems can be specified, stored, and so on.
2. Related Art
Rendering photo-realistic 2-D images from 3-D scene descriptions with ray tracing is well-known in the computer graphics arts. Ray tracing usually involves obtaining a scene description composed of geometric shapes, which describe surfaces of structures in the scene, and can be called primitives. A common primitive shape is a triangle.
Virtual rays of light are traced into the scene from a view point (“a camera”); each ray is issued to travel through a respective pixel of the 2-D representation, on which that ray can have an effect. The rays are tested for intersection with scene primitives to identify a first intersected primitive for each ray, if any.
After identifying an intersection for a given ray, a shader associated with that primitive determines what happens next. For example, if the primitive is part of a mirror, then a reflection ray is issued to determine whether light is hitting the intersected point from a luminaire, or in more complicated situations, subsurface reflection, and scattering can be modeled, which may cause issuance of different rays to be intersection tested. By further example, if a surface of an object were rough, not smooth, then a shader for that object may issue rays to model a diffuse reflection on that surface. As such, finding an intersection between a ray and a primitive is a step in determining whether and what kind of light energy may reach a pixel by virtue of a given ray, since what light is hitting that primitive still needs to be determined.
Thus, most conventional algorithms build a tree of rays in flight when ray tracing a scene, where the tree continues along each branch until it leaves the scene or hits a luminaire that does not issue new rays. Then, for those branches that hit light emissive objects (“luminaires”), the branches are rolled up through the primitive intersections, determining along the way what effect each primitive intersection has on the light that hits it. Finally, a color and intensity of light for the originally issued camera ray can be determined and stored in the buffer. The tree of rays is generally created by a number of material shaders. For example, a ray is outputted from a camera, and traced to find an intersection with a primitive, which is bound to a shader. That shader can issue another ray for testing, and it waits on the stack for color information to be returned for its ray (which can involve a number of other shaders, down the ray tree).
Normally, origins and directions for the rays need to be specified in order to test the rays for intersection. Other information for such rays may also be used. Computation and memory costs for setting up data for a large number of rays can be high, and it would be helpful to be able to reduce them.